<!DOCTYPE html>
<html lang="en">
<head>
    <title>每周五销售预测填报</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-store, must-revalidate">
    <meta http-equiv="expires" content="Wed, 26 Feb 1997 08:21:57 GMT">
    <meta http-equiv="expires" content="-1">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="shortcut icon" href="/dist/img/icon.png" type="image/x-icon">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="/dist/plugins/bootstrap/css/bootstrap.min.css">
    <!--字体-->
    <link rel="stylesheet" href="/dist/css/font-awesome.min.css">
    <!--图标-->
    <link rel="stylesheet" href="/dist/css/ionicons.min.css">
    <!--插件样式-->
    <link href="/dist/plugins/ztree/css/zTreeStyle/zTreeStyle.css" rel="stylesheet"/>
    <!--OA主样式-->
    <link rel="stylesheet" href="/dist/css/OA.min.css?t=4a6c1b54">
    <link rel="stylesheet" href="/dist/css/skins/OA-skins.min.css?t=16f1e6f3">
    <style>
        .moduleName {
            height: 28px;
            line-height: 28px;
            font-size: 22px;
            border-bottom: 1px solid #ddd;
            text-align: center;

        }

        .tryStyle {
            width: 30px;
            height: 14px;
            line-height: 14px;
            font-size: 12px;
            /* top: 0; */
            right: 0;
            position: absolute;
            border-radius: 5px;
            margin-top: 1px;
            background: red;
            color: #fff;
            margin-right: -2px;
            transform: scale(0.8);
        }

        .nav-tabs-custom {
            padding: 10px 0;
            margin-bottom: 0;
            box-shadow: none;
            position: relative;
            overflow: hidden;
        }

        .infoReport {
            display: flex;
            justify-content: flex-start;
            text-align: left;
            margin-left: 10px;
        }

        .infoReport div {
            margin: 0 10px;
        }

        .lineOne {
            text-align: left;
        }

        .lineOne span {
            max-height: 20px;
            line-height: 20px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
            text-align: left;
        }

        .lineOneNoMore {
            text-align: left;
        }

        .lineOneNoMore span {
            max-height: 20px;
            line-height: 20px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
            text-align: left;
        }

        .mScrollBox {
            float: left;
            position: relative;
        }

        .imgStyle {
            width: 300px;
            height: 400px;
        }

        .div-td-content-more {
            position: absolute;
            height: auto;
            z-index: 999;
            line-height: 20px;
            background-color: #d3e8fd;
            padding: 8px 6px;
            border: 1px solid #e8e8ea;
            display: none;
        }

        .div-td-content-more i {
            width: 15px;
            height: 12px;
            background: url("/dist/img/more-icon.png");
            position: absolute;
            left: 50px;
            top: -12px;
        }

        .templateStyle {
            border: 1px solid #ddd;
            /*margin-bottom: 10px;*/
            padding: 0 10px;
        }

        .table > thead > tr > th {
            padding: 0;
        }

        .table > tbody > tr > td {
            position: relative;
        }

        .selectBox {
            height: 25px;
            margin-bottom: 10px;
        }

        .span-a-btn {
            position: absolute;
            right: 10px;
            top: 18px;
        }
        .left{
            width:150px;
            float: left;
        }
        .right{
            margin-left: 160px;
        }
        .btnList{
            position: fixed;
            bottom:15px;
            left:50%;
        }
    </style>
</head>
<body>
<section class="content" id="app" v-cloak>
    <div class="div-td-content-more"><i></i></div>
    <div class="row">
        <div class="left" id="inboxGroup" id="divLeft">
            <div class="box-body no-padding box-border iframeH" style="overflow-y: auto;background: #f7f8fa;">
                <ul class="ztree" id="ztree"></ul>
            </div>
        </div>
        <div class="right">
            <div class="templateStyle iframeH" style="overflow-y: auto;">
                <div class="nav-tabs-custom">
                    <div class="moduleName">当月8号零售预测</div>
                </div>
                <table class="table table-bordered text-center table-width">
                    <thead>
                    <tr>
                        <th rowspan="2" colspan="2">型号</th>
                        <th colspan="12">月份</th>
                        <th rowspan="2">全年总计</th>
                    </tr>
                    <tr style="background: yellow;">
                        <td>11</td>
                        <td>12</td>
                        <td>1</td>
                        <td>2</td>
                        <td>3</td>
                        <td>4</td>
                        <td>5</td>
                        <td>6</td>
                        <td>7</td>
                        <td>8</td>
                        <td>9</td>
                        <td>10</td>
                    </tr>
                    </thead>
                    <tbody>
                    <tr>
                        <td rowspan="3">100系列</td>
                        <td>E130LC</td>
                        <td>1</td>
                        <td>1</td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td>1</td>
                        <td></td>
                        <td></td>
                        <td>3</td>
                    </tr>
                    <tr>
                        <td>E140LC</td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td>1</td>
                        <td>1</td>
                    </tr>
                    <tr>
                        <td>100系列零售汇总</td>
                        <td>1</td>
                        <td>1</td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td>1</td>
                        <td></td>
                        <td>1</td>
                        <td>4</td>
                    </tr>
                    <tr>
                        <td rowspan="3">200系列</td>
                        <td>E210LC</td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td>1</td>
                        <td>1</td>
                    </tr>
                    <tr>
                        <td>E210SC</td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td>0</td>
                    </tr>
                    <tr>
                        <td>200系列零售汇总</td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td>1</td>
                    </tr>
                    <tr>
                        <td rowspan="3">300系列</td>
                        <td>E300LC</td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td>2</td>
                        <td></td>
                        <td>2</td>
                    </tr>
                    <tr>
                        <td>E330LC</td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td>1</td>
                        <td></td>
                        <td>1</td>
                    </tr>
                    <tr>
                        <td>300系列零售汇总</td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td>3</td>
                        <td></td>
                        <td>3</td>
                    </tr>
                    <tr>
                        <td rowspan="2">400系列</td>
                        <td>E400LC</td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td>1</td>
                        <td>1</td>
                        <td>2</td>
                    </tr>
                    <tr>
                        <td>400系列零售汇总</td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td>1</td>
                        <td>1</td>
                        <td>2</td>
                    </tr>
                    <tr>
                            <td rowspan="3">WL</td>
                        <td>WL53</td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td>0</td>
                    </tr>
                    <tr>
                        <td>WL56</td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td>0</td>
                    </tr>
                    <tr>
                        <td>WL零售汇总</td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td>0</td>
                    </tr>
                    <tr>
                        <td colspan="2">挖掘机零售总计</td>
                        <td>2</td>
                        <td>2</td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td>2</td>
                        <td>8</td>
                        <td>5</td>
                        <td>20</td>
                    </tr>
                    <tr>
                        <td colspan="2">零售总计</td>
                        <td>2</td>
                        <td>2</td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td>2</td>
                        <td>8</td>
                        <td>5</td>
                        <td>20</td>
                    </tr>
                    </tbody>
                </table>
                <!--<div class="div-btn text-center" style="padding-bottom: 10px;">-->
                    <!--<input type="button" style="margin-left:20px;" value="保存" class="btn btn-primary btn-sm" @click="save(0)">-->
            <!--</div>-->
            </div>
        </div>
    </div>
</section>
<script src="https://file.ggxqce.com/web/jquery-2.2.3.min.js"></script>
<!--插件JS-->
<script src="https://file.ggxqce.com/web/bootstrap.min.js"></script>
<!--框架已定义 JS-->
<script src="/dist/js/app_iframe.js?t=8e743a31"></script>
<!--oa自定义  JS-->
<script src="/dist/js/oa.js?t=54c6b89c"></script>
<script src="https://file.ggxqce.com/web/vue.min.js"></script>
<script type="text/javascript" src="/dist/plugins/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="/dist/plugins/lhgdialog/lhgdialog.min.js?self=true"></script>
<!--ztree组件所需js-->
<script type="text/javascript" src="/dist/plugins/ztree/js/jquery.ztree.all-3.5.min.js"></script>
<script type="text/javascript" src="/dist/plugins/ztree/js/jquery.ztree.exhide-3.5.js"></script>
<script type="text/javascript">
    var zTreeCallback = {
        showIcon: function (treeeId, treeNode) {
            return treeNode.isParent;
        },
        onClick: function (event, treeId, treeNode) {
            console.log(treeNode.type)
            if (treeNode.type == "region") {
                console.log(treeNode.type)
                app.regionId=treeNode.regionId;
                app.companyId=treeNode.companyId;
                app.getSelect();
            }
        },
        beforeClick:function (treeId, treeNode, clickFlag) {
            if(treeNode.level==0){
                return false;
            }
        }
    };
    var zTreeSetting = {
        view: {
            showIcon: zTreeCallback.showIcon
        },
        data: {
            simpleData: {
                enable: true
            },
            keep: {
                parent: true
            }
        },
        callback: {
            onClick: zTreeCallback.onClick,
            beforeClick:zTreeCallback.beforeClick
        }
    };

</script>
<script type="text/javascript">
    var app = new Vue({
        el: '#app',
        data: {
            main: {
                actualSaleRemark: '',
                firstMonth: '',
                secondMonth: '',
                thirdMonth: '',
                firstMonthBef:'',
                secondMonthBef:'',
                thirdMonthBef:'',
                day:new Date().Format("yyyy-MM-dd")
            },
            sub: [],
            getAll: {},
            companyName: '',
            companyId: '',
            regionName: '',
            regionId: '',
            date: new Date().Format("yyyy-MM-dd"),
            beforeWeek: '',
        },
        methods: {
            //获取合计
            getCount: function (arr, key) {
                var number = 0;
                for (var i = arr.length - 1; i >= 0; i--) {
                    number += (arr[i][key] && arr[i][key] != '-' ? arr[i][key] : 0)

                }
                return number;
            },
            //合并单元格
            tablesMergeCell: function (list) {
                for (field in list[0]) {
                    var k = 0;
                    while (k < list.length) {
                        list[k][field + 'span'] = 1;
                        list[k][field + 'dis'] = false;
                        for (var i = k + 1; i <= list.length - 1; i++) {
                            if (list[k][field] == list[i][field] && list[k][field] != '') {
                                list[k][field + 'span']++;
                                list[k][field + 'dis'] = false;
                                list[i][field + 'span'] = 1;
                                list[i][field + 'dis'] = true;
                            } else {
                                break;
                            }
                        }
                        k = i;
                    }
                }
                return list;
            },
            //初始化时间控件
            showDatePicker: function (e, type) {
                var that = this;
                WdatePicker({
                    onpicked: function (dp) {
                        that.selectParameter.day = dp.cal.getNewDateStr();
                        return true;
                    },
                    maxDate: new Date().Format("yyyy-MM-dd")//今天
                });
                $(e.target).blur();
            },
            getSelect: function () {
                var that = this;
                $.wyui.postMethod(urlConfig.yuce.select, {
                    userId: getCurrentUser().id,
                    companyId: that.companyId,
                    regionId: that.regionId,
                    date: that.date
                }, function (data) {
                    console.log(data)
                    that.sub = data.sub;
                    that.main = data.main;
                    if(!that.main.day){
                        that.main.day=new Date().Format("yyyy-MM-dd")
                        that.main.firstMonth=new Date().Format("yyyy-MM");
                        that.main.secondMonth=(that.getNextMonth(new Date().Format("yyyy-MM-dd"))).substring(0,7)
                        that.main.thirdMonth=(that.getNextMonth(that.getNextMonth(new Date().Format("yyyy-MM-dd")))).substring(0,7)
                    }
                    that.getAll.firstMonthYuce = that.getCount(that.sub, "firstMonth");
                    that.getAll.secondMonthYuce = that.getCount(that.sub, "secondMonth");
                    that.getAll.thirdMonthYuce = that.getCount(that.sub, "thirdMonth");
                });
            },
            //获取树
            getTreeData:function () {
                var that=this;
                $.wyui.postMethod(urlConfig.yuce.getCompanyRegionTree, {
                    userId:getCurrentUser().id,
                    date:new Date().Format("yyyy-MM-dd")
                }, function (nodes) {
                    console.log(nodes)
                    for(var i=0;i<nodes.length;i++){
                        if(nodes[i].name=='重庆迎风'){
                            nodes.splice(i,1);
                        }
                    }
                    that.treeObj = $.fn.zTree.init($("#ztree"), zTreeSetting, nodes);
//                    var treeObj = $.fn.zTree.getZTreeObj("ztree");
//                    var nodes = treeObj.getNodes();
//                    console.log(nodes)
//                    if (nodes[0].children[0].children[0]) {
//                        console.log(nodes[0].children[0].children[0])
//                        treeObj.selectNode(nodes[0].children[0].children[0]);
//                        that.companyId=nodes[0].children[0].children[0].companyId;
//                        that.regionId=nodes[0].children[0].children[0].id;
////                        that.getSelect();
//                    }
                });
            },
        },

        mounted: function () {
            this.getTreeData();
        }
    });

</script>
</body>
</html>